/*
 * 2006-04-18 Li Ximing, Zhang Yanbo - Create.
 */
package com.hd123.rumba.log;

import java.util.Date;

import com.hd123.rumba.domain.IDomain;
import com.hd123.rumba.exception.StringTooLongException;
import com.hd123.rumba.runtime.Persistent;

/**
 * 操作日志 | 实体 | 抽象实现类
 * 
 * @author lxm
 * @author zhangyanbo
 * 
 */
public abstract class OperateLog extends Persistent implements IOperateLog {

  private IDomain domain = null;
  private String operator = "";
  private Date time = new Date();
  private String settleNo = null;
  private String event;
  private String message;

  public String getSettleNo() {
    return settleNo;
  }

  public void setSettleNo(String settleNo) throws StringTooLongException {
    if (settleNo != null)
      settleNo = COperateLog.truncate(settleNo, COperateLog.LENGTH_SETTLENO, "settleNo",
          COperateLog.CAPTION_SETTLENO);
    this.settleNo = settleNo;
  }

  public IDomain getDomain() {
    return domain;
  }

  public void setDomain(IDomain domain) {
    this.domain = domain;
  }

  public String getEvent() {
    return event;
  }

  public void setEvent(String event) throws StringTooLongException {
    if (event != null)
      event = COperateLog.truncate(event, COperateLog.LENGTH_EVENT, "event",
          COperateLog.CAPTION_EVENT);
    this.event = event;
  }

  public String getMessage() {
    return message;
  }

  public void setMessage(String message) throws StringTooLongException {
    if (message != null)
      message = COperateLog.truncate(message, COperateLog.LENGTH_MESSAGE, "message",
          COperateLog.CAPTION_MESSAGE);
    this.message = message;
  }

  public String getOperator() {
    return operator;
  }

  public void setOperator(String operator) throws StringTooLongException {
    if (operator != null)
      operator = COperateLog.truncate(operator, COperateLog.LENGTH_OPERATOR, "operator",
          COperateLog.CAPTION_OPERATOR);
    this.operator = operator;
  }

  public Date getTime() {
    return time;
  }

  public void setTime(Date time) {
    this.time = time;
  }

}
